package com._23DesignPattern._filter;

import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * @author huangya
 * @date 2022/9/16
 */
@Component
public class DefalutProcesserChain implements ProcesserChain {

    public List<Processer> processerList = new ArrayList<>();

    @Override
    public List<Processer> getProcesserList() {
        return processerList;
    }

    @Override
    public void addProcesser(Processer processer) {
        processerList.add(processer);
    }

    @Override
    public void doProcess(){
        for (int i = 0; i < processerList.size(); i++) {
            Processer processer = processerList.get(i);
            processer.doProcess();
        }
    }
}
